/**     Global Method  **/
 
#include "scoreSort.h"
#include <string>
#include <fstream>
#include <iomanip>
#include <iostream>
using namespace std;
 
void li::DispStuList(Stu* stuPtrs[],int n)
{
    for(int i=0; i<n; i++)
        stuPtrs[i]->disp();
 
    cout << endl << endl;
}
 
 
int  li::ReadStuList(const char *  filename, Stu* stuPtrs[])
{
    string name;
    int s1,s2,s3;
    ifstream in(filename);
    int cnt=0;
 
    while(in >> name >> s1 >> s2 >> s3)
    {
        stuPtrs[cnt++] =  new Stu(name,s1,s2,s3);
    }
    in.close();
 
    return cnt;
}
 
void li::StuSort(Stu* stuPtrs[], int n,
                 bool Gt(const Stu*  ,const Stu* ))
{
    for(int i=1; i<n; i++)
    {
        for(int j=0; j<n-i; j++)
        {
            if(!Gt( stuPtrs[j],stuPtrs[j+1]))
            {
                Stu* temp;
                temp = stuPtrs[j];
                stuPtrs[j] = stuPtrs[j+1];
                stuPtrs[j+1] = temp;
            }
        }//for
    }//for
}

